package com.zzp.baidu.api;

import com.zzp.baidu.domain.SearchPage;
import com.zzp.baidu.service.NewsSearchService;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * <p>
 *  //TODO
 *  BaiduSearchController.java
 * </p>
 * @version v0.0.1
 * @author 佐斯特勒
 * @date 2021/2/14 22:12
 * @see  com.zzp.baidu.api
 **/
@RestController
@RequestMapping("/news")
@CrossOrigin(origins = "*")
public class BaiduSearchController {
    @Resource
    private NewsSearchService newsSearchService;


    @GetMapping("/suggest")
    public Object suggestSearch(String prefix){
        return newsSearchService.suggest(prefix);
    }


    @GetMapping("/search")
    public Object executeSearch(SearchPage searchPage){
        return newsSearchService.search(searchPage);
    }
}
